package com.xuelang.pipeline.worker.client.crd.dto;

import com.xuelang.pipeline.worker.client.common.result.BaseK8sDTO;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1Secret;
import lombok.Data;

import jakarta.validation.constraints.NotEmpty;
import java.util.HashMap;
import java.util.Map;

/**
 * @author liuyuan.ly
 * @since 2024/7/8 15:48
 */
@Data
public class SecretDTO extends BaseK8sDTO {
    private static final long serialVersionUID = -7245697225701356042L;
    private String secretName;
    @NotEmpty(message = "命名空间不能为空")
    private String namespaceName;
    private V1Secret v1Secret;
    private Map<String, byte[]> data;

    public static void main(String[] args) {
        V1Secret secret = new V1Secret();
        secret.apiVersion("v1");
        secret.setKind("Secret");
        V1ObjectMeta v1ObjectMeta = new V1ObjectMeta();
        v1ObjectMeta.setName("test");
        v1ObjectMeta.setNamespace("default");
        secret.setMetadata(v1ObjectMeta);
        Map<String, String> stringDataMap = new HashMap<>();
        String json = "{\"auths\":{\"registry.cn-hangzhou.aliyuncs.com\":{\"auth\":\"dasdmapodsa213ds234\"}}}";
        stringDataMap.put("config.json:", json);
        secret.setStringData(stringDataMap);






    }



}
